package com.cocos.game

import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.provider.Settings
import android.util.Log
import com.cocos.service.SDKWrapper.SDKInterface
import com.facebook.FacebookSdk
import com.facebook.appevents.AppEventsLogger


class FacebookCocosSDK : SDKInterface {

    companion object {
        @SuppressLint("StaticFieldLeak")
        var instance: FacebookCocosSDK? = null
        private const val TAG = "FacebookCocosSDK"
    }

    var activity: Activity? = null

    override fun init(context: Context?) {
        this.activity = context as Activity
        Log.i(TAG, "init: $TAG")
        instance = this

        JsbSDK.onMsg("FacebookCocosSDK.getApplicationSignature") { args -> this.getApplicationSignature(args) }
    }

    private fun getApplicationSignature(args: String) {
        Log.i(TAG, "getApplicationSignature: $args");
//        AppEventsLogger.
        var signature = FacebookSdk.getApplicationSignature(this.activity)
        Log.i(TAG, "getApplicationSignature: $signature")
    }

}